<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'adsManage.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link href="css/css.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/xiangmu.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>  
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />  
<script type="text/javascript">
	function loginName() {
		$.ajax({
			type : "post",//发送方式       
			url : "admin/findAllAdsPosList.action",// 路径   
			data : "",
			success : function(dataRole) {
				var obj = new Function("return" + dataRole)();//
				var html = "";
				for ( var i = 0; i < obj.length; i++) {
					html += "<option value='"+obj[i].adsPosId+"'>" + obj[i].adsPos + "</option>";
				}
				$("#ajaxJsonSelectId>option").remove();
				$("#ajaxJsonSelectId").append(html);
			}
		});

	}
</script>

<script type="text/javascript" src="layer-v1.5.1/layer/layer.min.js"></script>
<script type="text/javascript">
	//全选
	function checkAll(name) {
		var names = document.getElementsByName(name);
		var len = names.length;
		if (len > 0) {
			var i = 0;
			for (i = 0; i < len; i++) {
				names[i].checked = true;
			}
		}
	}

	//全不选
	function checkAllNo(name) {
		var names = document.getElementsByName(name);
		var len = names.length;
		if (len > 0) {
			var i = 0;
			for (i = 0; i < len; i++) {
				names[i].checked = false;
			}
		}
	}

	//反选
	function reserveCheck(name) {
		var names = document.getElementsByName(name);
		var len = names.length;
		if (len > 0) {
			var i = 0;
			for (i = 0; i < len; i++) {
				if (names[i].checked) {
					names[i].checked = false;
				} else {
					names[i].checked = true;
				}
			}
		}

	}

	function XXX() {
		document.checkIds.submit();
	}
	
	function adsAdd() {
		window.location.href="admin/adsManage/addAds.jsp";
	}
	
</script>
</head>
<body onload="loginName()">
	<table id="mainpage" width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td height="62" background="images/nav04.gif">
							<form action="admin/findByAdsPos" method="post">
								<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
									<tr>
										<td width="21"><img src="images/ico07.gif" width="20" height="18" /></td>
										<td width="550">
											按广告位置：
											<select id="ajaxJsonSelectId" name="ads.adsPosId" style="width: 130px;" >
												
											</select>
											<span class="newfont06"></span> 
											&nbsp;&nbsp;&nbsp;
											<input type="button" onclick="adsAdd()" target="mainFrame" class="right-button08" value="增加广告" />
										</td>
									</tr>
								</table>
							</form>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<form name="checkIds" id="checkIds" action="admin/deleteAds" method="post" >
					<table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td>
								<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
									<tr>
										<td height="20">
											<span class="newfont07">选择： 
												<input type="radio" name="choice" id="ckall" onclick="checkAll('adsId','ckall')" />全选- 
												<input type="radio" name="choice" id="ckReserve" onclick="reserveCheck('adsId','ckReserve')" />反选 
											</span>
											<input type="submit" onclick="MsgDel()" class="right-button08" value="删除所选信息" />
									</tr>
									<tr>
										<td height="40" class="font42">
											<table width="100%" border="0" cellpadding="4" align="center" cellspacing="1" bgcolor="#464646" class="newfont03">
												<tr>
													<td height="20" colspan="7" align="center" bgcolor="#EEEEEE" class="tablestyle_title">消息总列表</td>
												</tr>
												<tr align="center" bgcolor="#EEEEEE">
													<td width="4%" height="24">选择</td>
													<td width="10%">广告名称</td>
													<td width="10%">广告开始时间</td>
													<td width="10%">广告结束时间</td>
													<td width="10%">链接地址</td>
													<td width="20%">备注</td>
													<td width="5%">操作</td>
												</tr>
												<c:forEach items="${requestScope.pages.records}" var="list">
													<tr align="center" bgcolor="#FFFFFF" height="24px">
														<td><input type="checkbox" name="adsId" value="${list.adsId }" /></td>
														<td>${list.adsName }</td>
														<td>${list.beginDate }</td>
														<td>${list.endDate }</td>
														<td>${list.url }</td>
														<td style="text-overflow:ellipsis;">${list.remarks }</td>
														<td>
															<a href="admin/detailAds.action?adsIdStr=${list.adsId }">查看</a>&nbsp;&nbsp;
															<a href="admin/updateAdsInfo.action?adsIdStr=${list.adsId }">修改</a>
														</td>
													</tr>
												</c:forEach>
											</table>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
					<jsp:include page="/page.jsp" />
				</form>
			</td>
		</tr>
	</table>
</body>
</html>
